package com.liyujie.dyeingmachine.pop;

import android.content.Context;
import android.view.View;

import androidx.annotation.NonNull;

import com.liyujie.dyeingmachine.R;
import com.liyujie.dyeingmachine.listener.OnGeneralCallback;
import com.liyujie.dyeingmachine.views.NoDoubleClickListener;
import com.lxj.xpopup.core.CenterPopupView;

public class CylinderBlockOperationPopup extends CenterPopupView {
    /**
     * 回调
     */
    private OnGeneralCallback onGeneralCallback;

    public CylinderBlockOperationPopup(@NonNull Context context) {
        super(context);
    }


    @Override
    protected int getImplLayoutId() {

        return R.layout.popup_cylinder_block_operation;

    }


    @Override
    protected void onCreate() {
        super.onCreate();
        /**
         * 绑定试剂
         */
        findViewById(R.id.BindingReagent).setOnClickListener(new NoDoubleClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                if (null != onGeneralCallback) {
                    onGeneralCallback.onGeneralCallback(10);
                }
                dismiss();
            }
        });
        /**
         * 解除绑定
         */
        findViewById(R.id.Unbind).setOnClickListener(new NoDoubleClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                if (null != onGeneralCallback) {
                    onGeneralCallback.onGeneralCallback(20);
                }
                dismiss();
            }
        });

        /**
         * 取消染色
         */
        findViewById(R.id.undyeing).setOnClickListener(new NoDoubleClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                if (null != onGeneralCallback) {
                    onGeneralCallback.onGeneralCallback(30);
                }
                dismiss();
            }
        });

        /**
         * 测试染色
         */
        findViewById(R.id.TestDyeing).setOnClickListener(new NoDoubleClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                if (null != onGeneralCallback) {
                    onGeneralCallback.onGeneralCallback(40);
                }
                dismiss();
            }
        });


    }

    public void setOnGeneralCallback(OnGeneralCallback onGeneralCallback) {
        this.onGeneralCallback = onGeneralCallback;
    }
}
